﻿using pachon;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PachonDemo
{
    public partial class PlanFrom : Form
    {
        public bool _bol = true;

        string filePath = System.AppDomain.CurrentDomain.BaseDirectory+ "plan.xml";
        Comm com=new Comm ();

        public PlanFrom()
        {
            InitializeComponent();
            pcModelPlan pmp = null;

            pmp = (pcModelPlan)com.Load(typeof(pcModelPlan), filePath);

            if (pmp != null)
            {
                setvalue(pmp);
            }

        }

        public void setvalue(pcModelPlan pmp)
        {
            cbxinqi1.Checked = pmp.cbxinqi1;
            cbxinqi2.Checked = pmp.cbxinqi2;
            cbxinqi3.Checked = pmp.cbxinqi3;
            cbxinqi4.Checked = pmp.cbxinqi4;
            cbxinqi5.Checked = pmp.cbxinqi5;
            cbxinqi6.Checked = pmp.cbxinqi6;
            cbxinqi7.Checked = pmp.cbxinqi7;

            cbmoth1.Checked = pmp.cbmoth1;
            cbmoth2.Checked = pmp.cbmoth2;
            cbmoth3.Checked = pmp.cbmoth3;
            cbmoth4.Checked = pmp.cbmoth4;
            cbmoth5.Checked = pmp.cbmoth5;
            cbmoth6.Checked = pmp.cbmoth6;
            cbmoth7.Checked = pmp.cbmoth7;
            cbmoth8.Checked = pmp.cbmoth8;
            cbmoth9.Checked = pmp.cbmoth9;
            cbmoth10.Checked = pmp.cbmoth10;
            cbmoth11.Checked = pmp.cbmoth11;
            cbmoth12.Checked = pmp.cbmoth12;

         cbhost17.Checked =   pmp.cbhost17 ;
            cbhost18.Checked=  pmp.cbhost18;
            cbhost19.Checked=  pmp.cbhost19;
            cbhost20.Checked=  pmp.cbhost20;
            cbhost21.Checked=  pmp.cbhost21;
            cbhost22.Checked=  pmp.cbhost22;
            cbhost23.Checked=  pmp.cbhost23;
            cbhost24.Checked=  pmp.cbhost24;
           cbhost9.Checked  =  pmp.cbhost9 ;
            cbhost10.Checked=  pmp.cbhost10;
            cbhost11.Checked=  pmp.cbhost11;
            cbhost12.Checked=  pmp.cbhost12;
            cbhost13.Checked=  pmp.cbhost13;
            cbhost14.Checked=  pmp.cbhost14;
            cbhost15.Checked=  pmp.cbhost15;
            cbhost16.Checked=  pmp.cbhost16;
           cbhost8.Checked  = pmp.cbhost8 ; 
            cbhost7.Checked  = pmp.cbhost7 ;
            cbhost6.Checked=   pmp.cbhost6 ;
            cbhost5.Checked=   pmp.cbhost5 ;
            cbhost4.Checked=   pmp.cbhost4 ;
            cbhost3.Checked=   pmp.cbhost3; 
            cbhost2.Checked=   pmp.cbhost2; 
            cbhost1.Checked=   pmp.cbhost1; 
        }

        private void butPlan_Click(object sender, EventArgs e)
        {
            _bol = true;
            this.Close();
        }

        private void butliji_Click(object sender, EventArgs e)
        {
             _bol = false;
            this.Close();
           
        }

        private void butSave_Click(object sender, EventArgs e)
        {
      pcModelPlan pmp = new pcModelPlan();

          pmp.cbxinqi1= cbxinqi1.Checked;
          pmp.cbxinqi2= cbxinqi2.Checked;
          pmp.cbxinqi3= cbxinqi3.Checked;
          pmp.cbxinqi4= cbxinqi4.Checked;
          pmp.cbxinqi5= cbxinqi5.Checked;
          pmp.cbxinqi6= cbxinqi6.Checked;
          pmp.cbxinqi7= cbxinqi7.Checked;
         
          pmp.cbmoth1=cbmoth1.Checked;
          pmp.cbmoth2=cbmoth2.Checked;
          pmp.cbmoth3=cbmoth3.Checked;
          pmp.cbmoth4=cbmoth4.Checked;
          pmp.cbmoth5=cbmoth5.Checked;
          pmp.cbmoth6=cbmoth6.Checked;
          pmp.cbmoth7=cbmoth7.Checked;
          pmp.cbmoth8=cbmoth8.Checked;
          pmp.cbmoth9=cbmoth9.Checked;
          pmp.cbmoth10= cbmoth10.Checked;
          pmp.cbmoth11= cbmoth11.Checked;
          pmp.cbmoth12= cbmoth12.Checked;
          
          pmp.cbhost17= cbhost17.Checked;
          pmp.cbhost18= cbhost18.Checked;
          pmp.cbhost19= cbhost19.Checked;
          pmp.cbhost20= cbhost20.Checked;
          pmp.cbhost21= cbhost21.Checked;
          pmp.cbhost22= cbhost22.Checked;
          pmp.cbhost23= cbhost23.Checked;
          pmp.cbhost24= cbhost24.Checked;
          pmp.cbhost9= cbhost9.Checked;
          pmp.cbhost10= cbhost10.Checked;
          pmp.cbhost11= cbhost11.Checked;
          pmp.cbhost12= cbhost12.Checked;
          pmp.cbhost13= cbhost13.Checked;
          pmp.cbhost14= cbhost14.Checked;
          pmp.cbhost15= cbhost15.Checked;
          pmp.cbhost16= cbhost16.Checked;
          pmp.cbhost8= cbhost8.Checked;
          pmp.cbhost7= cbhost7.Checked;
          pmp.cbhost6= cbhost6.Checked;
          pmp.cbhost5= cbhost5.Checked;
          pmp.cbhost4= cbhost4.Checked;
          pmp.cbhost3= cbhost3.Checked;
          pmp.cbhost2= cbhost2.Checked;
          pmp.cbhost1= cbhost1.Checked;
            com.Save(pmp,filePath);
            MessageBox.Show("保存成功...");
        }

       
    }
}
